<?php
require_once("vcl/vcl.inc.php");
require_once("lib/db_connection.php");
//Includes
use_unit("comctrls.inc.php");
use_unit("forms.inc.php");
use_unit("extctrls.inc.php");
use_unit("stdctrls.inc.php");

//Class definition
class update_create extends Page
{
       public $Image1 = null;
       public $hfCompanyId = null;
       public $memoRemarks = null;
       public $memoUpdate = null;
       public $dtpDate = null;
       public $Button2 = null;
       public $Submit = null;
       public $Label3 = null;
       public $Label2 = null;
       public $Label1 = null;
       function SubmitClick($sender, $params)
       {
       $query_add = "INSERT INTO prospects_updates_tbl
       (company_id, date, updates, jti_remark) VALUES
       ('".$this->hfCompanyId->getValue()."','".$this->dtpDate->Text."',
       '".$this->memoUpdate->Text."','".$this->memoRemarks->Text."')";
       mysql_query($query_add) or die("INSERT UPDATE ".mysql_error());

       echo '<script language=javascript>
       window.opener.location.reload();
       alert("Successfully Added Record!");
       window.close();
       </script>';
       }

       function update_createCreate($sender, $params)
       {
       $company_id = $_GET['company_id'];
       $this->hfCompanyId->setValue($company_id);

       $this->dtpDate->Text = date('Y-m-d');
       $this->memoUpdate->Lines = array();
       $this->memoRemarks->Lines = array();
       }

       function Button2JSClick($sender, $params)
       {

       ?>
       window.close();

       <?php

       }

}

global $application;

global $update_create;

//Creates the form
$update_create=new update_create($application);

//Read from resource file
$update_create->loadResource(__FILE__);

//Shows the form
$update_create->show();

?>